package org.glavo.bot.data

object Advancements {
    private fun readAdvancements(): Map<String, String> {
        val res = linkedMapOf<String, String>()
        Minecraft.lang.forEach { (key, value) ->
            if (key.startsWith("advancements.") && key.endsWith(".title")) {
                val zh = Minecraft.langZh[key]
                if (zh != null) {
                    res[value] = zh
                }
            }
        }
        return res
    }

    @Volatile
    private var data: Map<String, String> = readAdvancements()

    fun reload() {
        data = readAdvancements()
    }

    operator fun get(name: String?): String? = data[name]
}



